#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int max_area = 0;
        while (left != right)
        {
            int size = (height[left] < height[right] ? height[left] : height[right]) * (right - left);
            if (size > max_area) max_area = size;
            if (height[left] < height[right]) left++;
            else right--;
        }
        return max_area;
    }
};